{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# MIME Outputs\n",
    "\n",
    "You can put math and HTML into notebooks directly with markdown cells. BeakerX also has an API for generation and display of multimedia content."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "Latex('$\\\\alpha^2 + \\\\eta$')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "HTML('<h1>Hello, world!</h1>')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "new MIMEContainer('text/html', '<h1> Hello World!</h1>')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "new MIMEContainer(MIMEContainer.MIME.TEXT_HTML, '<h1> Hello World!</h1>')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "new MIMEContainer('text/latex', '$\\\\alpha^2 + \\\\eta$')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "FileLinks(\"../groovy\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "FileLink(\"PlotFeatures.ipynb\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "Markdown(\"It's **very** easy to do **bold** and *italics*:\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "Math('F(k) = \\\\int_{-\\\\infty}^{\\\\infty} f(x) e^{2\\\\pi i k} dx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "IFrame('http://jupyter.org/', '100%', 400)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "ScribdDocument(\"71048089\", width: '50%', height: 400, start_page: 5, view_mode: 'slideshow')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "VimeoVideo(\"139304565\", width: 400, height: 300)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "YoutubeVideo(\"gSVvxOchT8Y\", start: 1800, autoplay: 1, width: 800, height: 600)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "Video('https://archive.org/download/Sita_Sings_the_Blues/Sita_Sings_the_Blues_small.mp4')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "SVG(\"https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/car.svg\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "SVG(\"../resources/img/atom.svg\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "Image(\"http://beakerx.com/static/img/twosigma.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "Image(\"../resources/img/widgetArch.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import java.nio.file.Files;\n",
    "import java.nio.file.Paths;\n",
    "import java.nio.file.Path;\n",
    "\n",
    "Path path = Paths.get(\"../resources/img/widgetArch.png\");\n",
    "byte[] bytes = Files.readAllBytes(path);\n",
    "\n",
    "Image(bytes)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import java.awt.image.BufferedImage\n",
    "bi = new BufferedImage(256, 80, BufferedImage.TYPE_INT_ARGB)\n",
    "g = bi.getGraphics()\n",
    "g.setColor(java.awt.Color.BLUE.darker())\n",
    "g.fillRoundRect(10, 10, 246, 70, 10, 10)\n",
    "g.setColor(java.awt.Color.YELLOW)\n",
    "g.setFont(new java.awt.Font(\"monospaced\", java.awt.Font.BOLD, 30))\n",
    "g.drawString(\"Hello world!\", 30, 55)\n",
    "g.drawLine(30, 60, 246, 60)\n",
    "g.dispose()\n",
    "Image(bi)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "beakerx_kernel_parameters": {},
  "kernelspec": {
   "display_name": "Groovy",
   "language": "groovy",
   "name": "groovy"
  },
  "language_info": {
   "codemirror_mode": "groovy",
   "file_extension": ".groovy",
   "mimetype": "",
   "name": "Groovy",
   "nbconverter_exporter": "",
   "version": "2.4.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": false,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": false,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
